package com.zmj.sy.mom.srv.aps.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.service.MbdDataMaintainService;
import com.zmj.sy.mom.srv.mbd.api.bean.dto.mbdUpdata.TbSizeInfoDto;
import com.zmj.sy.mom.srv.mbd.api.bean.vo.SizeInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Slf4j
@RequiredArgsConstructor
@Api(tags = "mbd数据维护")
@RestController
@RequestMapping("/mbdDataMaintain")
public class MbdDataMaintainController{

    private final MbdDataMaintainService mbdDataMaintainService;

    /**
     * @Description: 查询工件尺寸信息
     *
     * @author: hejiahui
     * @since: 2023/10/6 8:17
     */
    @ApiOperation(value = "1.0 查询工件尺寸信息", notes = "@作者  hejiahui   @操作时间 2023年9月27日14:23:31")
    @GetMapping(value = "/getNewPartSize")
    public BaseListResVo<SizeInfoVo> getNewPartSize(@ApiParam(value = "零件", required = true) @RequestParam(name = "plmid") String plmid) {
        List<SizeInfoVo> result = mbdDataMaintainService.getNewPartSize(plmid);
        return BaseListResVo.of(result, SizeInfoVo.class);
    }
    /**
     * @Description: 工件尺寸信息修改接口
     *
     * @author: hejiahui
     * @since: 2023/10/6 8:17
     */
    @ApiOperation(value = "1.1 工件尺寸信息修改接口", notes = "@作者  hejiahui   @操作时间 2023年9月27日14:23:31")
    @PostMapping(value = "/updateNewPartSize")
    public BaseResVo updateNewPartSize(@RequestBody TbSizeInfoDto dto) {
        mbdDataMaintainService.updateNewPartSize(dto);
        return BaseResVo.ok("修改成功！");
    }
    /**
     * @Description: 新增组件尺寸和重量
     *
     * @author: hejiahui
     * @since: 2023/10/10 10:14
     */
    @ApiOperation(value = "1.2 新增组件尺寸和重量", notes = "@作者  hejiahui   @操作时间 2023年10月10日10:14:31")
    @PostMapping(value = "/insertNewPartSize")
    public BaseResVo insertNewPartSize(@RequestBody TbSizeInfoDto dto) {
        mbdDataMaintainService.insertNewPartSize(dto);
        return BaseResVo.ok("修改成功！");
    }
}
